<?php

define('SESSION_TIME', 30 * 24 * 60 * 60 ); //hour 
session_cache_expire( SESSION_TIME );// minutes
session_start();
define(  '_Wang' , 1  );//defined( '_JEXEC' ) or die($lang_restricted_access );
//error_reporting(0);

$version = 'v 0.9.9';

require('include/config.php');
require('include/function.php');

require('include/lang.php');

define('WEB_NAME', lang_web_name );

$_POST = sql_injection($_POST);
$_GET = sql_injection($_GET);



require('include/conn.php');
require('class/global.php');
require('class/admin.class.php');
require('class/user.class.php');
require('class/tag.class.php');
require('class/systemTask.calss.php');
require('class/navigation.class.php');


$dataType  	= getQuery('dataType');
$isJSON  	= getQuery('isJSON'); // 1 ,0
$isJSON		= $isJSON == '' ? 1 : 0;
$do			= getQuery('do');
$option  	= getQuery('option');
$page		= getPage('page');
$type = $_GET['type'];


$systemTask = new systemTask();
$systemTask -> buildTag();// 每天第一个用户从新建立 tag 排布.


$navigation = new navigation();



$isExists = false; // 是否存在 option 引用

$fileType =  ROOTPATH . $type  . DS .$option.'.php';
$filePageEvent =  ROOTPATH . 'pageEvent'. DS .$option.'.php';
$fileTemp =  ROOTPATH . 'templates'. DS .$option.'.php';


if(file_exists( $fileType )){
	$isExists = true;
	require($fileType);
	exit();
}

if(file_exists($filePageEvent )){
	$isExists = true;
	require($filePageEvent);
}


if( file_exists( $fileTemp )){
	$isExists = true;
	require($fileTemp);
}

if( !$isExists && '' != $option ){
	//header('Location:/');
	require('errorStatus/404.html');	
	exit('');
}

if( '' == $option ){
	require('pageEvent/index.php');
	require('templates/index.php');
}

unset($isExists);
?>